package com.dji.sample.wayline.model.dto;

import com.dji.sample.common.util.kmlModel.TravelRecordRequest;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author yjt
 * @date 2022-09-28
 * @description:
 */
@Data
public class UploadKmlDto implements Serializable {
    @JsonProperty(value = "id")
    private Long id;

    @JsonProperty(value = "name")
    private String name;

    @JsonProperty(value = "workspaceId")
    private String workspaceId = "e3dea0f5-37f2-4d79-ae58-490af3228069";

    @JsonProperty(value = "deviceNo")
    public String[] deviceNo;

    @JsonProperty(value = "originCoordinate")
    public List<TravelRecordRequest> originCoordinate;

    @JsonProperty(value = "travelRecordRequests")
    private List<TravelRecordRequest> travelRecordRequests;

    private Long orgId;

    private String orgCode;

    private String username;

    //安全起飞高度
    @JsonProperty(value = "takeOffSecurityHeight")
    private String takeOffSecurityHeight;

    //全局航线高度
    @JsonProperty(value = "ellipsoidHeight")
    private String ellipsoidHeight;

    //全局速度
    @JsonProperty(value = "speed")
    private String speed;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonProperty(value = "startTime")
    private Date startTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonProperty(value = "endTime")
    private Date endTime;

    private Integer type;

    @JsonProperty(value = "payloadParam")
    private PayloadParam payloadParam;

    @JsonProperty(value = "droneInfo")
    private DroneInfo droneInfo;

    @JsonProperty(value = "payloadInfo")
    private PayloadInfo payloadInfo;

    @Data
    public static class PayloadInfo {
        /**
         * 负载机型主类型
         */
        public String payloadEnumValue = "53";
        /**
         * 负载机型子类型
         */
        public String payloadSubEnumValue = "0";

        /**
         * 负载挂载位置
         */
        public String payloadPositionIndex = "0";
    }

    @Data
    public static class DroneInfo {
        /**
         * 飞行器机型主类型
         */
        public String droneEnumValue = "67";
        public String droneSubEnumValue = "1";
    }

    @Data
    public static class PayloadParam {
        /**
         * 负载挂载位置
         */
        public String payloadPositionIndex = "0";

        /**
         * 负载对焦模式
         */
        public String focusMode = "firstPoint";

        /**
         * 负载测光模式
         */
        public String meteringMode = "average";

        /**
         * 负载采样率
         */
        public String samplingRate = "240000";


        public String returnMode = "singleReturnFirst";

        /**
         * 负载扫描模式
         */
        public String scanningMode = "repetitive";

        /**
         * 图片格式列表
         */
        public String imageFormat = "wide,zoom,ir";
    }


    public static void main(String[] str) {
        String js = "{\"name\":\"caac\",\"workspaceId\":\"e3dea0f5-37f2-4d79-ae58-490af3228069\",\"type\":1,\"takeOffSecurityHeight\":100,\"ellipsoidHeight\":\"1926.54478292933\",\"speed\":10,\"payloadInfo\":{\"payloadEnumValue\":\"53\",\"payloadSubEnumValue\":\"0\",\"payloadPositionIndex\":\"0\"},\"droneInfo\":{\"droneEnumValue\":\"67\",\"droneSubEnumValue\":\"1\"},\"payloadParam\":{\"payloadPositionIndex\":\"0\",\"focusMode\":\"firstPoint\",\"meteringMode\":\"average\",\"samplingRate\":\"240000\",\"scanningMode\":\"repetitive\",\"imageFormat\":\"wide,zoom,ir\"},\"travelRecordRequests\":[{\"id\":1,\"lng\":100.95775390123808,\"lat\":25.33489243696098,\"height\":1926.54478292933,\"actionGroup\":{\"actionGroupId\":\"0\",\"actionTrigger\":{\"actionTriggerType\":\"reachPoint\"},\"action\":[{\"actionId\":1,\"actionActuatorFunc\":\"gimbalRotate\",\"actionActuatorFuncParam\":{\"gimbalHeadingYawBase\":\"north\",\"gimbalRotateMode\":\"absoluteAngle\",\"gimbalYawRotateAngle\":\"20\"}},{\"actionId\":1,\"actionActuatorFunc\":\"takePhoto\",\"actionActuatorFuncParam\":{\"fileSuffix\":\"point1\"}}]}},{\"id\":2,\"lng\":101.86331220418717,\"lat\":25.33056451351135,\"height\":1926.54478292933,\"actionGroup\":{\"actionTrigger\":{\"actionTriggerType\":\"reachPoint\"},\"action\":[{\"actionId\":1,\"actionActuatorFunc\":\"startRecord\",\"actionActuatorFuncParam\":{\"fileSuffix\":\"530001001\",\"payloadLensIndex\":\"zoom\",\"useGlobalPayloadLensIndex\":\"0\"}}]}},{\"id\":3,\"lng\":101.40869611627895,\"lat\":25.061745356198692,\"height\":1926.54478292933,\"actionGroup\":{\"actionTrigger\":{\"actionTriggerType\":\"reachPoint\"},\"action\":[{\"actionId\":1,\"actionActuatorFunc\":\"stopRecord\",\"actionActuatorFuncParam\":{}}]}}}";

    }
}
